package com.headingdata.exercise;

public class Test7 {

    public static void main(String[] args) {
        //输出 101-200之间的素数
        int count = getPrimeNumber1(101,200);
        System.out.println(count);

    }
    public static int getPrimeNumber(int startNum, int endNum){
        int count = 0;
        for (int i = startNum; i <=endNum ; i++) {
            boolean flag = true;
            for (int j = 2; j < i/2; j++) {
                if(i % j == 0){
                    flag = false;
                    break;
                }
            }
            if (flag){
                System.out.println(i);
                count++;
            }
        }
        return count;
    }
    public static int getPrimeNumber1(int startNum, int endNum){
        int count = 0;
        OUT:
        for (int i = startNum; i <=endNum ; i++) {
            for (int j = 2; j < i/2; j++) {
                if(i % j == 0){
                    continue OUT;
                }
            }
            System.out.println(i);
            count++;
        }
        return count;
    }
}
